<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Region_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 * 根据ID得到地区信息
	 */
	public function load($id){
		$query = $this->db->get_where('t_region',array('id' => $id));
		if ($row = $query->row_array()){
			return $row;
		}
		return array();
	}
	/*
	 * 得到所有区的信息
	 */
	public function get_regions(){
		$this->db->where('type', 1);
		$query = $this->db->get('t_region');
		return $query->result_array();
	}
}
